//
//  GoodsDetailViewController.m
//  LoveHappyShopping
//
//  Created by 白水非泉 on 16/6/26.
//  Copyright © 2016年 白水非泉. All rights reserved.
//

#import "GoodsDetailViewController.h"
#import "GoodsCollectionCellModel.h"
#import "GoodsSearchResultModel.h"
@interface GoodsDetailViewController ()

@end

@implementation GoodsDetailViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNavBar];
    [self showTheViewInfo];
    // Do any additional setup after loading the view.
}
-(void)setNavBar{
    UIButton *btn=[[UIButton alloc]initWithFrame:CGRectMake(0, 0, 30, 30)];
    [btn setBackgroundImage:[UIImage imageNamed:@"btn_back"] forState:UIControlStateNormal];
    [btn addTarget:self action:@selector(backToForeView) forControlEvents:UIControlEventTouchUpInside];
    UIBarButtonItem *item=[[UIBarButtonItem alloc]initWithCustomView:btn];
    self.navigationItem.leftBarButtonItem=item;
    self.navigationItem.title=@"宝贝详情";   

}
-(void)backToForeView{
    self.tabBarController.tabBar.hidden=NO;
    [self.navigationController popViewControllerAnimated:YES];
    
    
}
-(void)showTheViewInfo{
//   NSString *title=[self.model.title stringByAddingPercentEncodingWithAllowedCharacters:[NSCharacterSet URLQueryAllowedCharacterSet]];
    NSString *idStr=nil;
    if (self.model) {
        idStr=self.model.num_iid;
    }
    else{
        idStr=self.resultModel.item_id;
    }
    NSString *urlStr=[NSString stringWithFormat:@"http://h5.m.taobao.com/awp/core/detail.htm?id=%@&ali_trackid=2:mm_30762647_13716691_55686051:1466908435_254_962366191&e=JCXfkAdFGMhw4vFB6t2Z2ueEDrYVVa64LKpWJ-in0XK3bLqV5UHdqeiWOsKOxF4mWiFs_jHb-cgq3gc7YO6zRbivfsC5lc0xonzPqyKKHwKEopUi023gf4C6lixyTB4LBqAel036-p8mgZh5Y3IfGTwQ-fo9lc_nvuye7AgdPcDh-7mbdZENizVWAFhnTOoenm_fwNBygVbsCNhiKzSmo3x8AGDaSMmB71igvPeTMqXDqywI0BhFq3fejLChCaVjr_8MFavbKmNScQffXU2P2UgdjzzTGTiEMtsJT6TBUoc&type=2&tkFlag=0",idStr];
    NSURL *url=[NSURL URLWithString:urlStr];
    NSURLRequest *request=[NSURLRequest requestWithURL:url];
    UIWebView *webView=[[UIWebView alloc]initWithFrame:self.view.frame];
    webView.backgroundColor=[UIColor whiteColor];
    [webView loadRequest:request];
    self.view=webView;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
